﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Portal.API;
using ObjectPersistence;
using KYO.DAL;
using BusinessLayerHelper;

public partial class _Default : System.Web.UI.Page
{
    TabAssembler tabService = new TabAssembler();
    protected void Page_Load(object sender, EventArgs e)
    {
        Tab tab = tabService.ReadSingleByKey(3);
        PersistentList<ModuleIntall> moduleIntalls = tab.ModuleIntallColl;
        Page page = (Page)HttpContext.Current.Handler;
        foreach (ModuleIntall mo in moduleIntalls)
        {
            Response.Write(mo.ID + " " + mo.ModuleObject.ModulePath + " " + mo.ModuleObject.FileName);
            ModuleBase module = (ModuleBase)page.LoadControl("~/Modules/" + mo.ModuleObject.ModulePath + "/" + mo.ModuleObject.FileName);

            //ModuleBase module2 = (ModuleBase)page.LoadControl("~/Modules/AnotherModule/AnotherControl.ascx");

            RightHolder.Controls.Add(module);
            RightHolder.Controls.Add(new LiteralControl("<" + "br" + ">"));
        }

       
      
     
       // RightHolder.Controls.Add(module2);
      
    }

    public IList<ModuleBase> LoadModule()
    {
        IList<ModuleBase> modules = new List<ModuleBase>();
        Page page = (Page)HttpContext.Current.Handler;
       // Module module = (Module)page.LoadControl("~/Modules/SampleModule.ascx");
 

       return modules;

    }
}
